from django.contrib import admin
from django.urls import path,re_path
from django.conf.urls import url, include
from django.contrib.auth.models import User
from rest_framework.routers import DefaultRouter
from webapp.views import *
from marketplace.views import *
from k8s.views import *
from elastic.views import *
from .auth import MyTokenObtainPairView
from rest_framework_simplejwt.views import (
    TokenObtainPairView,
    TokenRefreshView,
)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('group/',GroupListView.as_view(),name="group_list"),
    path('group/<int:pk>/', GroupDetailView.as_view(), name="group_details"),
    path('host/',HostListView.as_view(),name="host_list"),
    path('host/<int:pk>/',HostDetailView.as_view(),name="host_details"),
    path('appcatagory/',AppCatalogListView.as_view(),name="appcatagory_list"),
    path('appcatagory/<int:pk>/',AppCatalogDetailView.as_view(),name="appcatagory_detail"),
    path('apps',AppsListView.as_view(),name="app_list"),
    path('apps/<int:pk>/', AppsDetailView.as_view(),name="app_details"),
    path('appconfig/<int:pk>/', AppConfigDetailView.as_view(),name="appconfig_details"),
    path('appconfig/', AppConfigListView.as_view(), name="appconfig_list"),
    path('apprun/<int:pk>/',AppRun.as_view(),name="app_run"),
    path('k8s/',K8sListView.as_view(),name="k8s_list"),
    path('k8s/<str:namespace>/<str:deployment_name>/',K8sDetailView.as_view(),name="k8s_details"),
    path('nodes/',K8sNodeListView.as_view(),name="node_list"),
    path('jobs/',TrainingListView.as_view(),name="job_list"),
    path('job/<int:pk>/', TrainingDetailView.as_view(),name="job_detail"),
    path('jobrun/<str:uuid>/',TrainingRun.as_view(),name="k8sjob_run"),
    path('task/<str:task_name>/',TaskRecordDetailView.as_view(),name="task_detail"),
    path('jwt-auth/', MyTokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('index/', IndexListView.as_view(),name="indexes"),
    path('header/<int:pk>/',HeaderView.as_view(),name="index_detail"),
    path('logs/<int:pk>/', LogDetailView.as_view(),name="logs")

]

